﻿@inherits AdminCompontentBase
<SSheetDialog EnableDomReload @bind-Value=_visible Title="@T("Add Menu Permission")">
    <MCard Class="pt-9 d-flex flex-column full-height" Style="margin-left:228px;margin-right:228px;">
        <MCardText Class="full-height">
            <MForm Model=_menuPermissionDetailDto EnableValidation EnableI18n @ref="_form">
                <MRow>
                    <MCol Md=12>
                        <DccI18nConfiger @bind-Name="_menuPermissionDetailDto.Name" />
                    </MCol>
                    <MCol Md=12>
                        <STextField Label="@T("Code")" Required Prefix="@($"{_menuPermissionDetailDto.AppId}.")" @bind-Value="_menuPermissionDetailDto.Code" Messages='new List<string>{T("PermissionCodeMsg")}' Class="text-field permission-code" />
                    </MCol>
                    <MCol Md=6>
                        <SSelect @bind-Value="_menuPermissionDetailDto.Type"
                            Label="@T("Type")" Required
                            Items="TypeList()"
                            ItemText="u => u.Text"
                            ItemValue="u => u.Value">
                        </SSelect>
                    </MCol>
                    <MCol Md=6>
                        <SNumberTextField Label="@T("Order")" @bind-Value="_menuPermissionDetailDto.Order" />
                    </MCol>
                    <MCol Md=12>
                        <STextField Prefix="@_showUrlPrefix" Label="@T("URL")" @bind-Value="_menuPermissionDetailDto.Url" />
                    </MCol>
                    <MCol Md=12>
                        <STextarea Label="@T("Description")" @bind-Value="_menuPermissionDetailDto.Description"
                                   Height="120" NoResize HideDetails="@("auto")" />
                    </MCol>
                </MRow>
                <MDivider Left Class="my-6">@("UI")</MDivider>
                <MRow>
                    <MCol Md=6>
                        <STextField Label="@T("Icon")" Placeholder="@T("Support mdi and fas icon")" @bind-Value="_menuPermissionDetailDto.Icon">
                            <PrependContent>
                                <div class="d-flex align-center">
                                    <MIcon Size=30>
                                        mdi-image
                                    </MIcon>
                                </div>
                            </PrependContent>
                        </STextField>
                    </MCol>
                    <MCol Md=6>
                            <STextField Label="@T("MatchPattern")" @bind-Value="_menuPermissionDetailDto.MatchPattern" Tooltip="@T("MatchPatternTip")" />
                    </MCol>
                </MRow>
            </MForm>
        </MCardText>
        <MCardActions class="d-flex align-center mb-12 px-6">
            <EnableSwitch @bind-Value="_menuPermissionDetailDto.Enabled" />
            <MSpacer />
            <SButton Medium OnClick="OnSubmitHandler">@T("Submit")</SButton>
        </MCardActions>
    </MCard>
</SSheetDialog>
